const { ccclass, property } = cc._decorator;

import AbTestMgr from "./AbTestMgr";
import PeripheralSystemDataMgr from "./PeripheralSystemDataMgr";
import BasePageCtrl, { AnimType } from "./BasePageCtrl";
import TravelToastPage from "./TravelToastPage";

@ccclass
export default class TravelToastPageCtrl extends BasePageCtrl {
    ui = null;

    onLoad() {
        this.onUILoad();
        this._animType = AnimType.SCALE;
        this._touchControl = false;
        this._hasPeneLock = false;
        this._hasBlack = false;
        this._hasTouchLock = false;
        this._hasBlackTouch = false;
        this.addButtonListen();
        super.onLoad();
    }

    onUILoad() {
        this.ui = this.node.addComponent(TravelToastPage);
    }

    _init(e?) {
        if (e) {
            const type = e.text;

            // if (type == 1) {
            //     this.ui.des.getComponent(cc.RichText).string = "到达下一个城市即可领取奖励";
            // } else if (type == 2) {
            //     const cityName = PeripheralSystemDataMgr.getCityNameByCityId(cityId);
            //     let txt = `<color=#FFFFFF>到达</color><color=#08D9FF>${cityName}</color><color=#FFFFFF>即可领取奖励</color>`;
            //     const nextCityId = cityId + 1;
            //     const increaseCityArr = AbTestMgr.getIsTxtjsy() ? PeripheralSystemDataMgr.INCREASE_CITY_ARR2 : PeripheralSystemDataMgr.INCREASE_CITY_ARR;
            //     if (nextCityId == increaseCityArr[0]) {
            //         txt = `<color=#FFFFFF>到达</color><color=#08D9FF>${cityName}，</color><color=#FFFFFF>提现比例上升至1.2%</color>`;
            //     } else if (nextCityId == increaseCityArr[1]) {
            //         txt = `<color=#FFFFFF>到达</color><color=#08D9FF>${cityName}，</color><color=#FFFFFF>提现比例上升至1.4%</color>`;
            //     } else if (nextCityId == increaseCityArr[2]) {
            //         txt = `<color=#FFFFFF>到达</color><color=#08D9FF>${cityName}，</color><color=#FFFFFF>提现比例上升至1.6%</color>`;
            //     } else if (nextCityId == increaseCityArr[3]) {
            //         txt = `<color=#FFFFFF>到达</color><color=#08D9FF>${cityName}，</color><color=#FFFFFF>提现比例上升至30%</color>`;
            //     } else if (nextCityId == increaseCityArr[4]) {
            //         txt = `<color=#FFFFFF>到达</color><color=#08D9FF>${cityName}，</color><color=#FFFFFF>提现比例提升至120%</color>`;
            //     }
            //     this.ui.des.getComponent(cc.RichText).string = txt;
            // } else if (type == 3) {
            //     this.ui.des.getComponent(cc.RichText).string = "到达城市即可领取";
            // } else if (type == 4) {
            //     this.ui.des.getComponent(cc.RichText).string = "马上就能提现10000元红包，\n加速闯关吧！";
            // }
            this.ui.des.getComponent(cc.RichText).string = type;
            this.scheduleOnce(() => {
                this.hide();
            }, 1);
        }
    }

    addButtonListen() {
        // Implement the button listen logic here
    }

    clickClose() {
        this.hide();
    }

    static prefabUrl = "TravelToastPage";
    static className = "TravelToastPageCtrl";
}
